/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author bob
 */
public class MainMenu extends javax.swing.JFrame {

    /**
     * Creates new form MainMenu
     */
    
    public static final int X = 75;
    public static final int Y = 75;
    public MainMenu() {
        initComponents();
    }
   
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jButton5 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        genInfoButton = new javax.swing.JButton();
        utilitiesButton = new javax.swing.JButton();
        maintenanceButton = new javax.swing.JButton();
        disciplineButton = new javax.swing.JButton();
        paymentButton = new javax.swing.JButton();
        apartmentsButton = new javax.swing.JButton();

        jButton5.setText("Apartments");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Main Menu", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 24), new java.awt.Color(51, 51, 51))); // NOI18N

        genInfoButton.setText("General Information");
        genInfoButton.setDefaultCapable(false);
        genInfoButton.setFocusPainted(false);
        genInfoButton.setName("generalInfoButton"); // NOI18N
        genInfoButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                genInfoButtonMouseClicked(evt);
            }
        });
        genInfoButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                genInfoButtonActionPerformed(evt);
            }
        });

        utilitiesButton.setText("Utilities");
        utilitiesButton.setDefaultCapable(false);
        utilitiesButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                utilitiesButtonMouseClicked(evt);
            }
        });
        utilitiesButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                utilitiesButtonActionPerformed(evt);
            }
        });

        maintenanceButton.setText("Maintenance");
        maintenanceButton.setDefaultCapable(false);
        maintenanceButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                maintenanceButtonMouseClicked(evt);
            }
        });
        maintenanceButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                maintenanceButtonActionPerformed(evt);
            }
        });

        disciplineButton.setText("Disciplinary Actions");
        disciplineButton.setDefaultCapable(false);
        disciplineButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                disciplineButtonMouseClicked(evt);
            }
        });
        disciplineButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                disciplineButtonActionPerformed(evt);
            }
        });

        paymentButton.setText("Payments");
        paymentButton.setDefaultCapable(false);
        paymentButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                paymentButtonMouseClicked(evt);
            }
        });
        paymentButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                paymentButtonActionPerformed(evt);
            }
        });

        apartmentsButton.setText("Apartments");
        apartmentsButton.setDefaultCapable(false);
        apartmentsButton.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                apartmentsButtonMouseClicked(evt);
            }
        });
        apartmentsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                apartmentsButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(disciplineButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(utilitiesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(genInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 127, Short.MAX_VALUE)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(maintenanceButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(paymentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(apartmentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(38, 38, 38))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(genInfoButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(apartmentsButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(43, 43, 43)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(utilitiesButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(maintenanceButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(40, 40, 40)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(disciplineButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(paymentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(46, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(46, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(32, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void genInfoButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_genInfoButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_genInfoButtonActionPerformed

    private void utilitiesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_utilitiesButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_utilitiesButtonActionPerformed

    private void maintenanceButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_maintenanceButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_maintenanceButtonActionPerformed

    private void disciplineButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disciplineButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_disciplineButtonActionPerformed

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton5ActionPerformed

    private void paymentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_paymentButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_paymentButtonActionPerformed

    private void apartmentsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_apartmentsButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_apartmentsButtonActionPerformed

    private void genInfoButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_genInfoButtonMouseClicked
        
        //create general window
        General genWindow =  null;
        try {
            genWindow = new General();
        } catch (SQLException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ClassNotFoundException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
        genWindow.setLocation(MainMenu.X, MainMenu.Y);
        genWindow.setVisible(true);
                
        //close main window
        this.dispose();        
        
    }//GEN-LAST:event_genInfoButtonMouseClicked

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        
    }//GEN-LAST:event_formWindowClosing

    private void apartmentsButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_apartmentsButtonMouseClicked
        try {
            //create Apartment window
            Apartment aptWindow = new Apartment();
            aptWindow.setLocation(MainMenu.X, MainMenu.Y);
            aptWindow.setVisible(true);
                    
            //close main window
            this.dispose();
        } catch (SQLException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_apartmentsButtonMouseClicked

    private void utilitiesButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_utilitiesButtonMouseClicked
        //create Utilities window
        Utilities utilWindow = new Utilities();
        utilWindow.setLocation(MainMenu.X, MainMenu.Y);
        utilWindow.setVisible(true);
                
        //close main window
        this.dispose();    
    }//GEN-LAST:event_utilitiesButtonMouseClicked

    private void maintenanceButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_maintenanceButtonMouseClicked
        try {
            //create Maintenance window
            Maintenance maintWindow = new Maintenance();
            maintWindow.setLocation(MainMenu.X, MainMenu.Y);
            maintWindow.setVisible(true);
                    
            //close main window
            this.dispose();
        } catch (SQLException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_maintenanceButtonMouseClicked

    private void disciplineButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_disciplineButtonMouseClicked
        //create Discplinary Actions window
        Discipline discWindow = new Discipline();
        discWindow.setLocation(MainMenu.X, MainMenu.Y);
        discWindow.setVisible(true);
                
        //close main window
        this.dispose();          
    }//GEN-LAST:event_disciplineButtonMouseClicked

    private void paymentButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_paymentButtonMouseClicked
        try {
            //create Payments window
            Payments payWindow = new Payments();
            payWindow.setLocation(MainMenu.X, MainMenu.Y);
            payWindow.setVisible(true);
                    
            //close main window
            this.dispose();
        } catch (SQLException ex) {
            Logger.getLogger(MainMenu.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_paymentButtonMouseClicked

  
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton apartmentsButton;
    private javax.swing.JButton disciplineButton;
    private javax.swing.JButton genInfoButton;
    private javax.swing.JButton jButton5;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton maintenanceButton;
    private javax.swing.JButton paymentButton;
    private javax.swing.JButton utilitiesButton;
    // End of variables declaration//GEN-END:variables
}
